package com.wenwei.view;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.wenwei.parking.R;


/**
 * Created by Administrator on 2017/5/24.
 *
 * 自定义删除dialog
 */
public class PaySuccessDialog extends Dialog{


    TextView timeTv;
    ImageView closeImg;
    private Context mContext;
    public PaySuccessDialog(Context context) {
        super(context);
        mContext = context;
    }


    private DelDialogEvent mCallBack;

    public void setDelDialogEvent(DelDialogEvent event){
        mCallBack = event;
    }

    public interface DelDialogEvent{

        void onCancel();//取消
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.custom_login_popup);
        setCanceledOnTouchOutside(false);
        initView();
        initEvent();
    }

    private void initEvent() {
        closeImg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(mCallBack!=null){
                    mCallBack.onCancel();
                }
            }
        });

        TimeCountUtilView timeCountUtil = new TimeCountUtilView( (Activity)mContext,300000,1000,timeTv);
        timeCountUtil.start();
    }

    private void initView() {
        closeImg = (ImageView) findViewById(R.id.iv_close);
        timeTv = (TextView)findViewById(R.id.time_tv);
    }
}

